<template>
  <div>
    <van-nav-bar title="精品课程" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
      <template #right>
        <van-icon name="search" size="18" />
      </template>
    </van-nav-bar>
    <div class="content">
            <sessionItem :getData="getData"></sessionItem>
    </div>
  </div>
</template>

<script>
import sessionItem from "./ui/sessionItem.vue";
import { get } from "@/utils/http.js";

export default {
  components: {
    sessionItem,
  },
  methods: {
    async getData() {
      return await get("/session/goodSession");
    },
    onClickLeft() {
      this.$router.push("/search");
    },

    onClickRight() {
      Toast("按钮");
    },
    onLoad() {
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        // for (let i = 0; i < 10; i++) {
        //   this.list.push(this.list.length + 1);
        // }

        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.list.length >= 6) {
          this.finished = true;
        }
      }, 1000);
    },
  },
};
</script>

<style lang="scss" >
.van-nav-bar {
  position: fixed;
  top: 0;
  width: 100%;
}
.content {
  margin-top: 65px;
  padding-bottom: 10px;
}

</style>